#!/bin/bash
mkdir -p "./cmds"
mkdir -p "./cmds/include"

for netfn in 0x00 #0x02 0x04 0x06 0x08 0x0A 0x0C 0x2C 0x2E 0x30 0x32 0x34 0x36 0x38 0x3A 0x3C 0x3E 
do
    NETFN_NO=`printf '0x%02x' $netfn | tr a-z A-Z`
    for cmd in `seq 0 255`;
    do
        CMD_NO=`printf '0x%02x' $cmd | tr a-z A-Z`
        C_FILE="./cmds/NETFN"$NETFN_NO"_CMD_"$CMD_NO".c"
        H_FILE="./cmds/include/NETFN"$NETFN_NO"_CMD_"$CMD_NO".h"
        touch $C_FILE
        touch $H_FILE
        echo "" > $H_FILE
        echo "#include \"ipmi.h\"" >> $H_FILE
        echo "void register_NETFN_"$NETFN_NO"_CMD_"$CMD_NO"();" >> $H_FILE
        echo "" >> $H_FILE
    done
done
